package chanlib;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author robit
 */
public class Chan_Math {
    // Used to test all the rest of the methods.
    public static void main(String args[]){
        nCr(52,-1);
        System.out.println(C[52][1]);
    }
    //final static int bound;
    public static long[][] C;

    // valid for C(i,j) when i<=0, j>=0.
    public static void nCr(int bound,int mod){
        C=new long[bound+1][bound+1];
        C[0][0]=1;
        for(int n=1;n<=bound;n++){
            C[n][0]=1;
            for(int k=1;k<=n;k++){
                C[n][k]=C[n-1][k-1]+C[n-1][k];
                C[n][k]%=mod;
            }
        }
    }

    public static void nCr(int bound){
        C=new long[bound+1][bound+1];
        C[0][0]=1;
        for(int n=1;n<=bound;n++){
            C[n][0]=1;
            for(int k=1;k<=n;k++){
                C[n][k]=C[n-1][k-1]+C[n-1][k];                
            }
        }
    }

    public static long gcd(long a,long b){
        while(a!=0){
         //want a <- b%a, b <- a
         //first do a <- b, b <- a, followed by a<-a%b
            long temp=a;
            a=b%a;
            b=temp;
        }
        return b;
    }

    public static int gcd(int a,int b){
        while(a!=0){
         //want a <- b%a, b <- a
         //first do a <- b, b <- a, followed by a<-a%b
            a=a+b;
            b=a-b;
            a=a-b;
            a=a%b;
        }
        return b;
    }


}
